package settings;


import android.content.pm.PackageInfo;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.imstlife.vending.R;
import com.imstlife.vending.utils.T;

public class AboutAppFragment extends Fragment {

	private TextView versionTv;
	// 当前应用的版本名称
	private String versionName;
	// 当前版本的包名
	private String packageNames;

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		View rootLayout = inflater.inflate(R.layout.fragment_about, container,
				false);

		try {
			PackageInfo info = getActivity().getPackageManager()
					.getPackageInfo(getActivity().getPackageName(), 0);

			// 当前应用的版本名称
			versionName = info.versionName;
			T.showLong(getActivity(),"version："+versionName);
			// 当前版本的版本号
			// int versionCode = info.versionCode;
			// 当前版本的包名
			packageNames = info.packageName;

		} catch (Exception e) {
			e.printStackTrace();
		}

		versionTv = (TextView) rootLayout
				.findViewById(R.id.ac_about_version_tv);
		versionTv.setText("V " + versionName);

		return rootLayout;
	}

}
